using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Represents an user account with just neccessary properties for authentication
/// </summary>
public class AuthAccount : IBusinessEntity
{
    private string _username = string.Empty;
    private string _password = string.Empty;
    private string _role = string.Empty;

	public AuthAccount()
	{
	}

    public AuthAccount(string username, string password, string role)
    {
        _username = username;
        _password = password;
        _role = role;
    }

    public string UserName
    {
        get
        {
            return _username;
        }
        set
        {
            _username = value;
        }
    }

    public string Password
    {
        get
        {
            return _password;
        }
        set
        {
            _password = value;
        }
    }

    public string Role
    {
        get
        {
            return _role;
        }
        set
        {
            _role = value;
        }
    }

    #region IBusinessEntity Members

    public void Fill(System.Data.SqlClient.SqlDataReader reader)
    {
        if (DAL.ColumnExists(reader, "UserName"))
            _username = reader.GetString(reader.GetOrdinal("UserName"));
        if (DAL.ColumnExists(reader, "Password"))
            _password = reader.GetString(reader.GetOrdinal("Password"));
        if (DAL.ColumnExists(reader, "Role"))
            _role = reader.GetString(reader.GetOrdinal("Role"));
    }

    #endregion
}
